package com.cc.service.Impl;

import com.cc.entity.Employee;
import com.cc.mapper.EmployeeMapper;
import com.cc.service.EmployeeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    EmployeeMapper employeeMapper;
    @Override
    public List<Employee> getList() {
        return employeeMapper.getList();
    }
    @Override
    public int addEmployee(Employee employee) {
        return employeeMapper.addEmployee(employee);
    }

    @Override
    public PageInfo<Employee> getPage(Integer pageNum) {
        PageHelper.startPage(pageNum, 5);
        List<Employee> list = employeeMapper.getList();
        PageInfo<Employee> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}

